# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=spf
pkgver=85.344ac2f
pkgrel=9
groups=('blackarch' 'blackarch-social')
pkgdesc='A python tool designed to allow for quick recon and deployment of simple social engineering phishing exercises.'
arch=('any')
url='https://github.com/tatanus/SPF'
license=('custom:unknown')
depends=('python' 'python-dnspython' 'python-twisted' 'phantomjs')
optdepends=('beef' 'theharvester')
makedepends=('git')
source=("$pkgname::git+https://github.com/tatanus/SPF.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md Install.txt \
    Requirements.txt
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE Install.txt Requirements.txt

  cp -a spf/* "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  cat > "$pkgdir/usr/bin/$pkgname-report" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python report.py "\$@"
EOF

  cat > "$pkgdir/usr/bin/$pkgname-web" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python web.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/"*
}

